var express = require('express');
var musr = require('./users');
const mapi = require('../wssclnt');
var router = express.Router();

router.get('/', function (req, res, next) {
  if (musr.isLogined(req)) {
    res.render('index', {
      "pushing":mapi.isPushing(),
      "connected":mapi.isConnected(),
      "nexttry":mapi.connecttrialer.nextTrialTime(),
      "user": musr.getUser(req), 
      "server":mapi.server,
      "pusher": mapi.pusher_cmd,
      "id":mapi.id,
      "key":mapi.key
    });
  } else {
    res.render('index2', { "user": musr.getUser(req) });
  }
});

module.exports = router;
